// 配置是否关闭请求打印日志
const defaultConfig = {
    debugState: false
};

function requestLogger({
    url,
    header,
    method,
    data,
    response
}) {
    const { debugState } = defaultConfig;
    // 配置下如果设置关闭则直接不执行后面的
    if (!debugState) return;
    const pages = getCurrentPages();
    const currentPage = pages[pages.length - 1].route;
    const log = {
        currentPage,
        url,
        method,
        header,
        data
    };
    console.log("请求的接口：" + url);
    console.log("请求参数与数据为：");
    console.log(log);
    console.log("返回参数为：");
    console.log(response);
}

export {
    requestLogger,
    defaultConfig
};